
import {  Shape } from '@antv/x6';


const portgrp = {
  in: {
    position: 'left',
    attrs: {
      circle: {
        r: 6,
        magnet: true,
        stroke: '#31d0c6',
        strokeWidth: 2,
        fill: '#fff',
      },
    },
  },
  out: {
    position: 'right',
    attrs: {
      circle: {
        r: 6,
        magnet: true,
        stroke: '#31d0c6',
        strokeWidth: 2,
        fill: '#fff',
      },
    },
  },
}

const portitm = [
  {
    id: 'port1',
    group: 'in',
  },
  {
    id: 'port2',
    group: 'out', 
  },
]

export const cSt = new Shape.Circle({
  width: 60,
  height: 60,
  attrs: {
    circle: { fill: '#FE854F', strokeWidth: 6, stroke: '#4B4A67' },
    text: { text: 'Start', fill: 'white' },
    kind: { type:'func', cls:'Start'}
  },
  tools: [
  {
    name: 'button-remove',  // 工具名称
    args: { x: 10, y: 10 }, // 工具对应的参数
  },],
  ports: {
    groups:portgrp,
    items: portitm,
  },
})

export const cEd = new Shape.Circle({
  width: 60,
  height: 60,
  label:'End',
  attrs: {
    circle: { fill: '#4B4A67', 'stroke-width': 6, stroke: '#FE854F' },
    text: { text: 'End', fill: 'white' },
    kind: { type:'func', cls:'End'}
  },
  tools: [
  {
    name: 'button-remove',  // 工具名称
    args: { x: 10, y: 10 }, // 工具对应的参数
  },],
  ports: {
    groups:portgrp,
    items: portitm,
  },
})

export const rUn = new Shape.Rect({
  width: 70,
  height: 40,
  label:'Unit',
  attrs: {
    rect: { fill: '#31D0C6', stroke: '#4B4A67', strokeWidth: 6 },
    kind: { type:'svr', cls:'unit'}
  },
  tools: [
  {
    name: 'button-remove',  // 工具名称
    args: { x: 10, y: 10 }, // 工具对应的参数
  },],
  ports: {
    groups:portgrp,
    items: portitm,
  },
})


export const rScript = new Shape.Rect({
  width: 70,
  height: 40,
  label:'Script',
  attrs: {
    rect: { fill: '#FE854F', stroke: '#4B4A67', strokeWidth: 6 },
    kind: { type:'func', cls:'Script'}
  },
  tools: [
  {
    name: 'button-remove',  // 工具名称
    args: { x: 10, y: 10 }, // 工具对应的参数
  },],
  ports: {
    groups:portgrp,
    items: portitm,
  },
})
